﻿namespace Zen.BlackBerry.Web.Models
{
	using System;
	using System.ComponentModel.DataAnnotations;
	using Zen.BlackBerry.Push.AppManagement;

	public class ApplicationModel
	{
		public Guid Id
		{
			get;
			set;
		}

		[Required]
		[Display(Name = "Name", Order = 1)]
		public string Name
		{
			get;
			set;
		}

		[Display(Name = "Description", Order = 2)]
		public string Description
		{
			get;
			set;
		}

		[Display(Name = "Version", Order = 3)]
		[Required]
		public string Version
		{
			get;
			set;
		}

		[Display(Name = "Created date", Order = 4)]
		[Editable(false)]
		[DataType(DataType.DateTime)]
		public DateTime CreatedDate
		{
			get;
			set;
		}

		[Display(Name = "Last updated date", Order = 5)]
		[Editable(false)]
		[DataType(DataType.DateTime)]
		public DateTime LastUpdateDate
		{
			get;
			set;
		}

		[Display(Name = "Last updated by", Order = 6)]
		[Editable(false)]
		public string LastUpdateBy
		{
			get;
			set;
		}

		[Display(Name = "Start date", Order = 7, Prompt = "Valid from")]
		[Required]
		[DataType(DataType.Date)]
		public DateTime StartDate
		{
			get;
			set;
		}

		[Display(Name = "Expiry date", Order = 8, Prompt = "Valid until")]
		[DataType(DataType.Date)]
		public DateTime? ExpiryDate
		{
			get;
			set;
		}

		[Display(Name = "Application type", Order = 9, ShortName = "Type")]
		[Required]
		public PushApplicationType ApplicationType
		{
			get;
			set;
		}

		[Display(Name = "Application Id", Order = 10, Description = "For public or public+enterprise applications, this is provided by RIM.")]
		[Required]
		public string ApplicationId
		{
			get;
			set;
		}

		[Display(Name = "Push port", Order = 11)]
		[Required]
		public int PushPort
		{
			get;
			set;
		}

		[Display(Name = "User name", Order = 12)]
		[Required]
		public string UserName
		{
			get;
			set;
		}

		[DataType(DataType.Password)]
		[Display(Name = "Public password", Order = 13)]
		public string PublicPassword
		{
			get;
			set;
		}

		[DataType(DataType.Password)]
		[Display(Name = "Enterprise password", Order = 14)]
		public string EnterprisePassword
		{
			get;
			set;
		}

		[Display(Name = "Public notification url")]
		public string PublicNotificationUrl
		{
			get;
			set;
		}

		[Display(Name = "Enterprise notification url")]
		public string EnterpriseNotificationUrl
		{
			get;
			set;
		}

		[Display(Name = "Max daily pushes", Order = 15)]
		public int MaximumDailyPushes
		{
			get;
			set;
		}

		[Display(Name = "Default push TTL", Order = 16)]
		[DataType(DataType.Duration)]
		public TimeSpan DefaultPushTtl
		{
			get;
			set;
		}

		[Display(Name = "Service level", Order = 17)]
		public PushApplicationServiceLevel ServiceLevel
		{
			get;
			set;
		}

		[Display(Name = "Is disabled", Order = 18)]
		public bool IsDisabled
		{
			get;
			set;
		}

		[Display(Name = "Is reliable", Order = 19)]
		public bool IsReliable
		{
			get;
			set;
		}

		[Display(Name = "Is storing requests", Order = 20)]
		public bool IsStoringRequests
		{
			get;
			set;
		}

		[Display(Name = "Is last notify enabled", Order = 21)]
		public bool IsLastNotificationEnabled
		{
			get;
			set;
		}

		[Display(Name = "Auto delete requests", Order = 22)]
		public bool AutoDeleteRequests
		{
			get;
			set;
		}

		[Display(Name = "Bypass subscriptions", Order = 23)]
		public bool BypassSubscriptions
		{
			get;
			set;
		}
	}

	public class DeleteApplicationModel
	{
		public Guid Id
		{
			get;
			set;
		}

		[Required]
		[Display(Name = "Name", Order = 1)]
		public string Name
		{
			get;
			set;
		}

		[Display(Name = "Description", Order = 2)]
		public string Description
		{
			get;
			set;
		}

		[Display(Name = "Version", Order = 3)]
		[Required]
		public string Version
		{
			get;
			set;
		}

		[Display(Name = "Created date", Order = 4)]
		[Editable(false)]
		[DataType(DataType.DateTime)]
		public DateTime CreatedDate
		{
			get;
			set;
		}

		[Display(Name = "Unsubscribe before delete", Order = 5)]
		public bool UnsubscribeBeforeDelete
		{
			get;
			set;
		}
	}
}